package com.fengshang.wedding.web.controller;

import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.fengshang.wedding.web.module.api.IModuleManager;
import com.fengshang.wedding.web.view.ModuleView;

@Controller
public class AjaxServiceController {
	private static Logger logger=Logger.getLogger(AjaxServiceController.class);
	@Autowired
	IModuleManager moduleManager;
	
	@RequestMapping(value = "/moduleService.do")
	public ModelAndView handleRequest(@RequestParam("module") String moduleId,
			@RequestParam("action") String action) {
		logger.info("moduleId:"+moduleId);
		logger.info("action:"+action);
		Map data=moduleManager.loadModule(moduleId);
		ModelAndView mav = new ModelAndView(new ModuleView());
		mav.addObject(ModuleView.MODULE_DATA,data);
		return mav;
	}

}
